package org.example.fronted.utils;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102300743263";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCo05jHBblOD02efu5JZ3UzfKKWZeBN3s2n02rndymP0ssmtrdFQ4hnPf8fcVmdxb6OfgAbCl4mDa8VPoqcJ38RmGz34W3oQrAqWkHoMYqLioO6zmWzMv4+54VhSkkIXwMWo5D1ty9ypCFt/rhJ7Y2QfQTeeOAfXtKYICymRJANAHd5tNSkzzF4LzHsRGJvrNdET5rvZ7QCMep4znCTO9i4dDevqO7BTo/XjKe0C0698YmQOMIC/vgT62EMFZuUr7bTfxhF1TAy4s21OWPz6sDJzTpAaqvyRK5XhQzEwWTLqdaH9C9RKUn0Kbz11PW0VLsGxfNypBkihdgm39DnRTq1AgMBAAECggEAcYbIh5zbvRghU+F7DzVY5KR9GLGtIfAfTymmC7xf4G0ZWxEnMJZ3FSXldxlb7/JXb65fF8/i+6fcAmcqAlO06Poc3JtksviVSgWjqCYYSjl815OPY+94dIhvcrrnXY+2nfSjt/fVGjwwlqzg9CWgOnc3XPrfi3jSGKYaIDyeuX5p3/SAT6AggiOJdELNN4bj5Xh6D0fY9cYRzJK4Rq4QTPlTsCYzQC7iMet5lH/D0cO8gOUgWlPWiWjXKv+4I6XfYFCXZO9S1OuUNgj5okXF55xwu7Z9MTLkt0XgHEMQHdS2HRJTd1vK9rDGvxPa+MTY+LHjsWdZMLYWC38b5hxqSQKBgQDyzg/B4Hd1YD58bMaPgK52MMFSsRRMRdW1HF4l5IvQQvPx4tOJmeHJ4LIWruKRdw+CdOWulo2cX+pjVAF1pcb/lqDeZHqZrcVjh+bIFR789IeX7+20y66Tn+fNhSBlazmH96VKpKQGMfxdh8JrG77vGKqvyLw6g7p9RMbX3hVMwwKBgQCyAFZEho5oX59RBCGgo0p6y9kapQo++4JOUv2DhUGcaxT9QtlBeSfpc8VpyWaLbWMcyyzGrda4Hbrukf15ntmkNOMDrIviTU/UbL/ajZoe6MPKZSwoZpa4ebjsp/9DSiaadu6i0GCtmDcHzwsbDJRAwCQjW8T6SDjcWvOf9FrDJwKBgA9zARmq+K7lQtST70ZuP6uRipuCXPJFd0Wg2nS6yBKmT/NSJXeZ7P31aB99XTk4RCpe2cZ0GeqbR8SuMbGUrMbShMXhytNAdVDR8uNERMZ/oKkQQSXB2AfYot023UrWucBnB4NqWm1yfMZOvxYlm86G2UV6Fk/61cDmwWg231AVAoGAMzHXnfPZR3mhF6sJhOsSA8lXUst+6+hobOB/m3EbEsLVkZXFaIhRC1rJv4g2XwmCBQkGgsoCxIeAeRcyAOXIEOtJE4hv3xF/UUhJ0bECT7uAfFim36PJ25rereoPh6nu+mQUdG1cMPFjenJ47jmq9giNHEJLn/RfrjjWcv3TkOcCgYEAzP8a8dByoqZyBC70B2PmQHl6h9ZhbczDhdyj6DP+KZsTBvS3A91R9I94g44wthM2tF09KEsHILpoVX2D8rk3KijvuREodClWNAjNg5ayxR68w1QzVaRhZE+WUNEu58VHCLkwyy2FgRrZg8h0yXJwkmfoSfhCJfWuJAFCAfz+ksw=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAioiKvVtZHUYF2qgzR85JxEgvb2xkVe5KXhpG6ll2zNBFkCDuUrICserFj44J6h3zd5L6rXyqapbsqgUCZpGpbBN22MWaRAUO4g1/1H6mtOtAcy986E1Lm6iYIheCAyC6pBIqT05Yvkb6HTYKWvc7yNxi26eQXcPtK+JMcHBM43CBtNzymMjGSxOlkJw8GQfFM9c4Pxrn55CHn6tc++lgI9GxfGlg0BNyikd5HnUtYW4I+QS6j/3F4JhHhfH+RCs8qyrOrP3x+ebd7lJYfAvgttOq0TB96LaIKvrkKNkoC/+r9LCbMSzTiEqtGW6ionRNA3truD4h3Y6wxsCXsCS5FQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://hello.free.idcfengye.com/paySuccess";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/showOrder.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

